<template>
  <div class="home-distribution">
    <div class="home-distribution-title">分配预警</div>
    <el-table :data="list" style="width: 100%">
      <el-table-column label="#" type="index" minwidth="50" fixed="left" align="center" width="50" />
      <el-table-column prop="shopName" label="店铺名称" min-width="180" />
      <el-table-column prop="baseSalary" label="店铺底薪" min-width="130" />
      <el-table-column prop="subAccountSalary" label="子账号分配总额" min-width="150" />
      <el-table-column prop="count" label="子账号数量" min-width="100" />
      <el-table-column fixed="right" label="操作" width="90">
        <template #default="{ row }">
          <el-button link type="primary" @click="onDetail(row)">
            查看详情
          </el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { getAssignAlert } from '../api'
import distributionDialog from './distributionDetail'

const list = ref([])
getAssignAlert()
  .then(res => {
    list.value = res || []
  })

const onDetail = row => {
  console.log(row)
  distributionDialog.open({ query: {shopId: row.shopId} })
}
</script>

<style scoped lang="scss">
.home-distribution {
  height: 405px;
  background: #FFFFFF;
  border-radius: 8px;
  padding: 25px;
  box-sizing: border-box;
  &-title {
    font-family: PingFangSC-Medium;
    font-weight: 500;
    font-size: 15px;
    color: #333333;
    margin-bottom: 12px;
  }
}
</style>
